<template>
<div>
  <h1>展示课程页面</h1>
  <table>
    <tr>
      <td>课程标题</td>
      <td>课程图片</td>
      <td>课程名称</td>
    </tr>
    <tr v-for="i in list">
      <td>{{i.title}}</td>
      <td><img :src="i.pic" alt="" width="100px"></td>
      <td>{{i.name}}</td>
    </tr>
  </table>
  <z_page :total='total' :page_size='page_size' @cpage='getpage'/>

</div>
</template>

<script>
import z_page from "./z_page";

export default {
  name: "courses_show",
  components:{
    'z_page':z_page},
  data(){
    return{
      list:[],
      total:1,
      page:1,
      page_size:2

    }
  },
  methods:{
    show(){
      this.$axios.get('users/courseM?page='+this.page)
      .then(i=>{
        this.list = i.data.list
        this.total = i.data.total
      })

    },
    //父组件接收子组件的值
    getpage(v){
      this.page = v
      this.show()
    }
  },
  mounted() {
    this.show()
  }
}
</script>

<style scoped>

</style>
